package com.gwm.order.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gwm.order.entity.TbOrderSeckillDetail;
import org.apache.ibatis.annotations.Select;

import java.util.List;


/**
 * <p>
 * 秒杀订单详情表 Mapper 接口
 * </p>
 *
 * @author heima
 * @since 2020-12-01
 */
public interface TbOrderSeckillDetailMapper extends BaseMapper<TbOrderSeckillDetail> {
    @Select("SELECT osd.seckill_id, sum(osd.num) num FROM tb_order o, tb_order_seckill_detail osd WHERE " +
            " o.order_id = osd.order_id  AND b_type = 2  AND o. STATUS = 1 AND TIMESTAMPDIFF(MINUTE, o.create_time, NOW()) > 5 " +
            "GROUP BY osd.seckill_id")
    List<TbOrderSeckillDetail> findOvertimeSeckillOrderDetail();

}
